const tool = require('../tools/tool')
const settings = require('../methods/settings')

module.exports = {
    get: {
        exp: '获取设置值',
        method: 'get',
        async func(data) {
            let re = await settings.getItem(data.query.key)
            if (re === undefined) throw '无此设置'
            return re
        }
    },
    set: {
        exp: '更新设置值',
        method: 'post',
        auth: {
            admin: true
        },
        async func(data) {
            await settings.setItem(data.param.key, data.param.value)
        }
    }
}